<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id='root'>
       <counter v-model:count="counter" v-model:count1="counter1"></counter>
    </div>
    <script>
        
        
        let app = Vue.createApp({
            data() {
                return {
                   counter:1,
                   counter1:2
                }
            }
        })
        
        app.component('counter',{
            // inheritAttrs:false, // 如果不想再div上显示 
            // 会在div上显示 count-abc="111"
            props:['count','count1'],
            template:`
                <div @click="handleClick">{{count}}</div>
                <div @click="handleClick1">{{count1}}</div>
            `,
            methods:{
                handleClick(){
                    this.$emit('update:count',this.count+2)
                },
                handleClick1(){
                    this.$emit('update:count1',this.count1+3)
                }
            }
        }) 

        let vm = app.mount('#root')
    </script>
</body>
</html>